<!doctype html>
<html class="no-js fixed-layout" xmlns:th="http://www.thymeleaf.org">
<head th:include="admin/include/admin-head-include"></head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
    以获得更好的体验！</p>
<![endif]-->

<header th:include="admin/include/admin-header-include" class="am-topbar am-topbar-inverse admin-header"></header>

<div class="am-cf admin-main">
    <!-- sidebar start -->
    <div th:include="admin/include/admin-sidebar-include" class="admin-sidebar am-offcanvas"
         id="admin-offcanvas"></div>
    <!-- sidebar end -->

    <!-- content start -->
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">首页</strong> /
                    <small>一些常用模块</small>
                </div>
            </div>
            <hr>


            <table class="am-table">
                <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">书名</th>
                    <th scope="col">封皮</th>
                    <th scope="col">借阅人</th>
                    <th scope="col">借阅时间</th>
                    <th scope="col">是否归还</th>
                    <th scope="col">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="borrow,start:${borrows}">
                    <td th:text="${start.index+1}"></td>
                    <td th:text="${borrow.bookVO.bookname}"></td>
                    <td><img height="50px" th:src="${borrow.bookVO.image}" alt=""></td>
                    <td th:text="${borrow.userVO.username}"></td>
                    <td th:text="${#dates.format(borrow.borrowTime, 'yyyy-MM-dd')}"></td>
                    <td th:text="${borrow.isReturn?'是':'否'}"></td>
                    <td><a href="javascript:void(0)" th:data-id="${borrow.borrowId}" onclick="urgedBook(this)">催还</a>

                    </td>
                </tr>
                </tbody>
            </table>
        </div>

        <footer th:include="admin/include/admin-footer-include" class="admin-content-footer"></footer>
    </div>
    <!-- content end -->

</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
   data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<script>
    function urgedBook(e) {
        var borrowId = $(e).attr('data-id');
        $.ajax({
            url: '/borrows/urged',
            type: 'post',
            data: {
                borrowId: borrowId
            },
            success: function (data) {
                alert("催换成功");
                location.reload()
            }
        })
    }
</script>
</body>
</html>
